<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 14587
  Date: 2020/11/11
  Time: 21:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>博客管理</title>
    <%--引入头文件--%>
    <%@include file="../common/head.jsp"%>
    <script type="text/javascript">

        $(function () {
            //查询ajax请求
            <%@include file="../common/searchAjax.jsp"%>
            //查询ajax请求
            $("#deleteId").click(function () {
                /*console.log("我在deleteId");*/
                return confirm("你确定要删除【"+$(this).parent().parent().find("td:first").next().text()+"】嘛？");
            });
        })
    </script>
</head>
<body class="pic-bg">
<div class="container-fluid">
    <div class="row-fluid">
        <div class="col-md-12">
            <h1 class="text-center" style="color: white">
                博客管理
            </h1>
            <div class="col-md-3">
                <h3>
                    <a href="${pageContext.request.contextPath}/page/showPage" style="color: white">首页</a>
                    &nbsp;|&nbsp;
                    <a href="${pageContext.request.contextPath}/cata/toCata" style="color: white">分类管理</a>
                </h3>
            </div>
            <div class="col-md-6"></div>
            <div class="col-md-3">
                <form class="form-search form-inline" action="${pageContext.request.contextPath}/blog/searchBlogAdmin" method="post">
                    <input id="input" autocomplete="off" class="input-medium search-query" name="title" type="text"/>
                    <button type="submit" class="btn">查找</button>
                </form>
            </div>
            <div class="col-md-3"></div>
            <div class="col-md-3"></div>
            <div class="col-md-3"></div>
            <div style="border-left: 3px solid #f7f7f7;border-top: 5px solid #a8a8a8;border-right: 2px solid #636363;border-bottom: 1px solid #5c5c5c;width: 200px" class="col-md-3" id="searchResult"></div>
        <div class="col-md-12" style="height:750px;overflow:auto">
                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th style="color:white;">
                            编号
                        </th>
                        <th style="color:white;">
                            博客名称
                        </th>
                        <th style="color:white;">
                            上传时间
                        </th>
                        <th style="color:white;">
                            浏览量
                        </th>
                        <th style="color:white;">
                            点赞量
                        </th>
                        <th style="color:white;">
                            操作
                        </th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach items="${blogs}" var="blog">
                    <tr class="success">
                        <td>${blog.blogId}</td>
                        <td>${blog.title}</td>
                        <td>${blog.date}</td>
                        <td>${blog.viewCount}</td>
                        <td>${blog.thumbCount}</td>
                        <td>
                            <a href="${pageContext.request.contextPath}/blog/toUpdateBlog/${blog.blogId}">修改</a>
                            &nbsp;|&nbsp;
                            <a id="deleteId" href="${pageContext.request.contextPath}/blog/deleteBlog/${blog.blogId}">删除</a>
                            &nbsp;|&nbsp;
                            <a href="${pageContext.request.contextPath}/cata/toCata?blogId=${blog.blogId}">添加分类</a>
                        </td>
                        </c:forEach>

                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
</body>
</html>
